package com.bdqn.hospital.controller;

import com.bdqn.hospital.pojo.MedicalAdvice;
import com.bdqn.hospital.pojo.SysUsers;
import com.bdqn.hospital.service.MedicalAdviceService;
import com.bdqn.hospital.service.impl.MedicalAdviceServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

/**
 * @version : 1.0
 * @Author :guogd
 * @createTime: 2023/03/01 14:35
 * @Description: com.bdqn.hospital.controller
 */
@Controller
@RequestMapping("medicalAdvice")
public class MedicalAdviceController {
    /**
     * 医嘱Controller
     */
    @Autowired
    private MedicalAdviceServiceImpl medicalAdviceService;
    @RequestMapping("insert")
    @ResponseBody
    public Integer insert(MedicalAdvice medicalAdvice, HttpSession session){
        SysUsers user = (SysUsers) session.getAttribute("user");
        medicalAdvice.setUserId(user.getId());
        return medicalAdviceService.insert(medicalAdvice);
    }
}
